package com.atguigu.spzx.manager.controller;

import com.atguigu.spzx.manager.service.SelfCartService;
import com.atguigu.spzx.model.vo.common.Result;
import com.atguigu.spzx.model.vo.common.ResultCodeEnum;
import com.atguigu.spzx.model.vo.sell.SellVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/shoppingcart")
public class SelfCartController {

    @Autowired
    private SelfCartService selfCartService;
    @GetMapping("/selfcart")
    public Result<SellVo> CartProduct(){
        List<SellVo> list = selfCartService.GetCartProduct();
        return Result.build(list, ResultCodeEnum.SUCCESS);
    }

    @DeleteMapping("/deletecart/{id}")
    public Result DeleteCartProduct(@PathVariable int id){
        selfCartService.DeleteCartProduct(id);
        return Result.build(null,ResultCodeEnum.SUCCESS);
    }
}
